package com.heking.securityapp.entiry;

import com.heking.security.sensitive.SensitiveField;

/**
 * @Author 35574
 * @Date 2021/11/1
 * @Description
 */
//@Sensitive(value = "info")
public class User {
  @SensitiveField
  private String name;
  @SensitiveField
  private String email;
  @SensitiveField
  private int age;
  @SensitiveField
  private boolean isManager;//
  @SensitiveField
  private boolean Dead;
  private User hideInfo;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public User getHideInfo() {
    return hideInfo;
  }

  public void setHideInfo(User hideInfo) {
    this.hideInfo = hideInfo;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public boolean isManager() {
    return isManager;
  }

  public void setManager(boolean manager) {
    isManager = manager;
  }

  public boolean isDead() {
    return Dead;
  }

  public void setDead(boolean dead) {
    Dead = dead;
  }

  public String getNameDesensitized() {
    if (hideInfo != null) {
      return hideInfo.getName();
    }
    return name;
  }

  public String getEmailDesensitized() {
    if (hideInfo != null) {
      return hideInfo.getEmail();
    }
    return email;
  }

  public int getAgeDesensitized() {
    if (hideInfo != null) {
      return hideInfo.getAge();
    }
    return age;
  }

  public boolean isManagerDesensitized() {
    if (hideInfo != null) {
      return hideInfo.isManager();
    }
    return isManager;
  }

  public boolean isDeadDesensitized() {
    if (hideInfo != null) {
      return hideInfo.isDead();
    }
    return Dead;
  }
}
